package com.woniuxy.food.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.cloud.mall95.log.Log;
import com.woniuxy.food.client.foodpropclient.FoodPropManageClient;
import com.woniuxy.food.client.param.InsertFoodPropParam;
import com.woniuxy.food.service.FoodPropService;
import com.woniuxy.food.service.serviceparam.InsertFoodPropServiceParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

@RestController
public class FoodPropManageClientApiImpl implements FoodPropManageClient {
    @Autowired
    private FoodPropService foodPropService;

    @Override
    @Log("添加菜品属性")
    public Result insertFoodProp(InsertFoodPropParam param) {
        InsertFoodPropServiceParam insertFoodPropServiceParam = BeanUtil.toBean(param, InsertFoodPropServiceParam.class);
        foodPropService.insertFoodProp(insertFoodPropServiceParam);
        return Result.success();
    }

    @Override
    @Log("根据ID删除菜品属性")
    public Result deleteFoodProp(Integer storeId,Integer foodPropId) {
        foodPropService.deleteFoodProp(storeId,foodPropId);
        return Result.success();
    }
}
